using OS.Infrastructure.Domain;
using OS.Infrastructure.NHibernate;
using OS.Infrastructure.NHibernate.Repositories;

namespace Domain.NHibernate
{
    public class AccountRepository: BaseRepository<Account>, IAccountRepository
    {
        public AccountRepository(ISessionProvider sessionProvider, ILinqProvider linqProvider) : base(sessionProvider ,linqProvider)
        {
        }
        public Account GetByName(string name)
        {
            var accounts =Session.QueryOver<Account>().Where(x => x.Name == name).List();
            return accounts.Count>0 ? accounts[0] : null;
        }

        public int MinRequiredPasswordLength
        {
            get { return MinPasswordLength.PasswordLength; }
        }
    }
}